<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - iris.info - frontend/impl/simMc2Mesh.cc</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../index.html">directory</a> - <a href="index.html">frontend/impl</a> - simMc2Mesh.cc</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>iris.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-05-24</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">131</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">96.9 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">127</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :  * =====================================================================================
<span class="lineNum">       3 </span>                :  *
<span class="lineNum">       4 </span>                :  *       Filename:  simMc2Mesh.cc
<span class="lineNum">       5 </span>                :  *
<span class="lineNum">       6 </span>                :  *    Description:  This is a 2x2 mesh network with 3 trace packet generators
<span class="lineNum">       7 </span>                :  *    and a single memory controller
<span class="lineNum">       8 </span>                :  *
<span class="lineNum">       9 </span>                :  *        Version:  1.0
<span class="lineNum">      10 </span>                :  *        Created:  04/20/2010 02:59:08 AM
<span class="lineNum">      11 </span>                :  *       Revision:  none
<span class="lineNum">      12 </span>                :  *       Compiler:  gcc
<span class="lineNum">      13 </span>                :  *
<span class="lineNum">      14 </span>                :  *         Author:  Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu
<span class="lineNum">      15 </span>                :  *        Company:  Georgia Institute of Technology
<span class="lineNum">      16 </span>                :  *
<span class="lineNum">      17 </span>                :  * =====================================================================================
<span class="lineNum">      18 </span>                :  */
<span class="lineNum">      19 </span>                : 
<span class="lineNum">      20 </span>                : #ifndef  _simmc2mesh_cc_INC
<span class="lineNum">      21 </span>                : #define  _simmc2mesh_cc_INC
<span class="lineNum">      22 </span>                : 
<span class="lineNum">      23 </span>                : #include        &quot;mesh.h&quot;
<span class="lineNum">      24 </span>                : #include        &quot;../../data_types/impl/flit.h&quot;
<span class="lineNum">      25 </span>                : #include        &quot;../../data_types/impl/highLevelPacket.h&quot;
<span class="lineNum">      26 </span>                : #include        &quot;../../components/impl/genericFlatMc.h&quot;
<span class="lineNum">      27 </span>                : #include        &quot;../../MemCtrl/mshr.cc&quot;
<span class="lineNum">      28 </span>                : #include        &lt;string.h&gt;
<span class="lineNum">      29 </span>                : #include        &lt;time.h&gt;
<span class="lineNum">      30 </span>                : 
<span class="lineNum">      31 </span>                : unsigned int no_nodes=0, no_mcs=0;
<span class="lineNum">      32 </span>                : unsigned long long int max_sim_time = 10000;
<span class="lineNum">      33 </span>                : unsigned int MC_ADDR_BITS = 22;
<span class="lineNum">      34 </span>                : int
<span class="lineNum">      35 </span><span class="lineCov">              1 : main ( int argc, char *argv[] )</span>
<span class="lineNum">      36 </span>                : {
<span class="lineNum">      37 </span><span class="lineCov">              1 :     uint sim_start_time = time(NULL);</span>
<span class="lineNum">      38 </span><span class="lineCov">              1 :     if(argc&lt;2)</span>
<span class="lineNum">      39 </span>                :     {
<span class="lineNum">      40 </span><span class="lineNoCov">              0 :         cout &lt;&lt; &quot;Error: Requires config file for input parameters\n&quot;;</span>
<span class="lineNum">      41 </span><span class="lineNoCov">              0 :         return 1;</span>
<span class="lineNum">      42 </span>                :     }
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span>                :     /* The following parameters must be specified in the config with the
<span class="lineNum">      45 </span>                :      * correct knobs */
<span class="lineNum">      46 </span><span class="lineCov">              1 :     uint vcs=0, ports=0, buffer_size=0, credits=0;</span>
<span class="lineNum">      47 </span><span class="lineCov">              1 :     uint grid_size=0; </span>
<span class="lineNum">      48 </span><span class="lineCov">              1 :     uint phy_link_bits = 128;</span>
<span class="lineNum">      49 </span>                :     vector&lt;string&gt; traces;
<span class="lineNum">      50 </span>                :     vector&lt;uint&gt; mc_positions;
<span class="lineNum">      51 </span>                :     string trace_name, output_path;
<span class="lineNum">      52 </span>                : 
<span class="lineNum">      53 </span><span class="lineCov">              1 :     ifstream fd(argv[1]);</span>
<span class="lineNum">      54 </span>                :     string data, word;
<span class="lineNum">      55 </span><span class="lineCov">             86 :     while(!fd.eof())</span>
<span class="lineNum">      56 </span>                :     {
<span class="lineNum">      57 </span><span class="lineCov">             85 :         getline(fd,data);</span>
<span class="lineNum">      58 </span><span class="lineCov">             85 :         istringstream iss( data, istringstream::in);</span>
<span class="lineNum">      59 </span><span class="lineCov">            338 :         while ( iss &gt;&gt; word )</span>
<span class="lineNum">      60 </span>                :         {
<span class="lineNum">      61 </span><span class="lineCov">             84 :             if ( word.compare(&quot;VCS&quot;) == 0)   </span>
<span class="lineNum">      62 </span>                :                 iss &gt;&gt; vcs;
<span class="lineNum">      63 </span><span class="lineCov">             84 :             if ( word.compare(&quot;PORTS&quot;) == 0) </span>
<span class="lineNum">      64 </span>                :                 iss &gt;&gt; ports;
<span class="lineNum">      65 </span><span class="lineCov">             84 :             if ( word.compare(&quot;BUFFER_SIZE&quot;) == 0)</span>
<span class="lineNum">      66 </span>                :                  iss &gt;&gt; buffer_size;
<span class="lineNum">      67 </span><span class="lineCov">             84 :             if ( word.compare(&quot;CREDITS&quot;) == 0)</span>
<span class="lineNum">      68 </span>                :                  iss &gt;&gt; credits;
<span class="lineNum">      69 </span><span class="lineCov">             84 :             if ( word.compare(&quot;GRID_SIZE&quot;) == 0)</span>
<span class="lineNum">      70 </span>                :                  iss &gt;&gt; grid_size;
<span class="lineNum">      71 </span><span class="lineCov">             84 :             if ( word.compare(&quot;NO_OF_NODES&quot;) == 0)</span>
<span class="lineNum">      72 </span>                :                 iss &gt;&gt; no_nodes;
<span class="lineNum">      73 </span><span class="lineCov">             84 :             if ( word.compare(&quot;MCS&quot;) == 0)</span>
<span class="lineNum">      74 </span>                :                 iss &gt;&gt; no_mcs;
<span class="lineNum">      75 </span><span class="lineCov">             84 :             if ( word.compare(&quot;MAX_SIM_TIME&quot;) == 0)</span>
<span class="lineNum">      76 </span>                :                 iss &gt;&gt; max_sim_time;
<span class="lineNum">      77 </span><span class="lineCov">             84 :             if ( word.compare(&quot;OUTPUT_PATH&quot;) == 0)</span>
<span class="lineNum">      78 </span><span class="lineCov">              1 :                 iss &gt;&gt; output_path;</span>
<span class="lineNum">      79 </span><span class="lineCov">             84 :             if ( word.compare(&quot;PHY_LINK_WIDTH&quot;) == 0)</span>
<span class="lineNum">      80 </span>                :                 iss &gt;&gt; phy_link_bits;
<span class="lineNum">      81 </span><span class="lineCov">             84 :             if ( word.compare(&quot;THREAD_BITS_POSITION&quot;) == 0)</span>
<span class="lineNum">      82 </span><span class="lineCov">              1 :                 iss &gt;&gt; THREAD_BITS_POSITION;</span>
<span class="lineNum">      83 </span><span class="lineCov">             84 :             if ( word.compare(&quot;MC_ADDR_BITS&quot;) == 0)</span>
<span class="lineNum">      84 </span>                :                  iss &gt;&gt; MC_ADDR_BITS;
<span class="lineNum">      85 </span><span class="lineCov">             84 :             if ( word.compare(&quot;TRACE&quot;) == 0)</span>
<span class="lineNum">      86 </span>                :             {
<span class="lineNum">      87 </span><span class="lineCov">             64 :                 iss &gt;&gt; trace_name;</span>
<span class="lineNum">      88 </span><span class="lineCov">             64 :                 traces.push_back(trace_name);</span>
<span class="lineNum">      89 </span>                :             }
<span class="lineNum">      90 </span><span class="lineCov">             84 :             if ( word.compare(&quot;MC_LOC&quot;) == 0)</span>
<span class="lineNum">      91 </span>                :             {
<span class="lineNum">      92 </span>                :                 uint mc_xpos, mc_ypos;
<span class="lineNum">      93 </span>                :                 iss &gt;&gt; mc_xpos;
<span class="lineNum">      94 </span>                :                 iss &gt;&gt; mc_ypos;
<span class="lineNum">      95 </span><span class="lineCov">              8 :                 mc_positions.push_back(mc_xpos*grid_size + mc_ypos);</span>
<span class="lineNum">      96 </span>                :             }
<span class="lineNum">      97 </span>                :         }
<span class="lineNum">      98 </span>                :     }
<span class="lineNum">      99 </span>                : 
<span class="lineNum">     100 </span><span class="lineCov">              7 : for ( uint i=0; i&lt;argc; i++)</span>
<span class="lineNum">     101 </span>                :     {
<span class="lineNum">     102 </span><span class="lineCov">              6 :         if( strcmp(argv[i],&quot;--thread_id_bits&quot;)==0)</span>
<span class="lineNum">     103 </span><span class="lineCov">              2 :             THREAD_BITS_POSITION = atoi(argv[i+1]);</span>
<span class="lineNum">     104 </span><span class="lineCov">              6 :         if( strcmp(argv[i],&quot;--mc_bits&quot;)==0)</span>
<span class="lineNum">     105 </span><span class="lineCov">              2 :             MC_ADDR_BITS = atoi(argv[i+1]);</span>
<span class="lineNum">     106 </span>                :     }
<span class="lineNum">     107 </span>                : 
<span class="lineNum">     108 </span>                :     /* Number of MC's and the size of the position vector should be the same. */
<span class="lineNum">     109 </span>                : //    assert(mc_positions.size() == no_mcs);
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                :     /* Compute additional parameters */
<span class="lineNum">     112 </span><span class="lineCov">              1 :     uint links = (ports + (grid_size -1)*(ports-1)) + ( (ports-1) + (grid_size -1)*(ports-2))*(grid_size-1);</span>
<span class="lineNum">     113 </span><span class="lineCov">              1 :     fd.close();</span>
<span class="lineNum">     114 </span>                : 
<span class="lineNum">     115 </span>                :         /* Creating mesh topology with the following config */
<span class="lineNum">     116 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot;\n-----------------------------------------------------------------------------------\n&quot;;</span>
<span class="lineNum">     117 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot;** CAPSTONE - Cycle Accurate Parallel Simulator Technologgy for On-Chip Networks **\n&quot;;</span>
<span class="lineNum">     118 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; This is simIris. A second version of Capstone.&quot; &lt;&lt; endl;</span>
<span class="lineNum">     119 </span>                :         cerr &lt;&lt; &quot;-- Computer Architecture and Systems Lab                                         --\n&quot;
<span class="lineNum">     120 </span>                :             &lt;&lt; &quot;-- Georgia Institute of Technology                                               --\n&quot;
<span class="lineNum">     121 </span><span class="lineCov">              1 :             &lt;&lt; &quot;-----------------------------------------------------------------------------------\n&quot;;</span>
<span class="lineNum">     122 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot;Cmd line: &quot;;</span>
<span class="lineNum">     123 </span><span class="lineCov">              7 :         for( int i=0; i&lt;argc; i++)</span>
<span class="lineNum">     124 </span><span class="lineCov">              6 :             cerr &lt;&lt; argv[i] &lt;&lt; &quot; &quot;;</span>
<span class="lineNum">     125 </span>                :         cerr &lt;&lt; endl;
<span class="lineNum">     126 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; vcs:\t&quot; &lt;&lt; vcs &lt;&lt; endl;</span>
<span class="lineNum">     127 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; ports:\t&quot; &lt;&lt; ports &lt;&lt; endl;</span>
<span class="lineNum">     128 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; buffer_size:\t&quot; &lt;&lt; buffer_size &lt;&lt; endl;</span>
<span class="lineNum">     129 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; credits:\t&quot; &lt;&lt; credits &lt;&lt; endl;</span>
<span class="lineNum">     130 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; no_nodes( spread over a 2D Mesh topology):\t&quot; &lt;&lt; no_nodes &lt;&lt; endl;</span>
<span class="lineNum">     131 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; grid size:\t&quot; &lt;&lt; grid_size &lt;&lt; endl;</span>
<span class="lineNum">     132 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; links:  \t&quot; &lt;&lt; links &lt;&lt; endl;</span>
<span class="lineNum">     133 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; no_of_mcs:\t&quot; &lt;&lt; no_mcs &lt;&lt; endl;</span>
<span class="lineNum">     134 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; no_of_traces:\t&quot; &lt;&lt; traces.size() &lt;&lt; endl;</span>
<span class="lineNum">     135 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; max_sim_time:\t&quot; &lt;&lt; max_sim_time &lt;&lt; endl;</span>
<span class="lineNum">     136 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; max_phy_link_bits:\t&quot; &lt;&lt; max_phy_link_bits &lt;&lt; endl;</span>
<span class="lineNum">     137 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; THREAD_BITS_POSITION:\t&quot; &lt;&lt; THREAD_BITS_POSITION&lt;&lt; endl;</span>
<span class="lineNum">     138 </span><span class="lineCov">              1 :         cerr &lt;&lt; &quot; MC_ADDR_BITS:\t&quot; &lt;&lt; MC_ADDR_BITS&lt;&lt; endl;</span>
<span class="lineNum">     139 </span>                : 
<span class="lineNum">     140 </span><span class="lineCov">              1 :     if( traces.size() &lt; (no_nodes - no_mcs) )</span>
<span class="lineNum">     141 </span>                :     {
<span class="lineNum">     142 </span><span class="lineNoCov">              0 :         cout &lt;&lt; &quot; Not enough trace files for simulation &quot; &lt;&lt; endl;</span>
<span class="lineNum">     143 </span><span class="lineNoCov">              0 :         exit(1);</span>
<span class="lineNum">     144 </span>                :     }
<span class="lineNum">     145 </span>                : 
<span class="lineNum">     146 </span><span class="lineCov">              1 :     Mesh* mesh = new Mesh();</span>
<span class="lineNum">     147 </span><span class="lineCov">              1 :     mesh-&gt;init( ports, vcs, credits, buffer_size, no_nodes, grid_size, links);</span>
<span class="lineNum">     148 </span><span class="lineCov">              1 :     mesh-&gt;max_sim_time = max_sim_time;</span>
<span class="lineNum">     149 </span>                : 
<span class="lineNum">     150 </span>                :     /* Create the mesh-&gt;routers and mesh-&gt;interfaces */
<span class="lineNum">     151 </span><span class="lineCov">             65 :     for( uint i=0; i&lt;no_nodes; i++)</span>
<span class="lineNum">     152 </span>                :     {
<span class="lineNum">     153 </span><span class="lineCov">             64 :         mesh-&gt;routers.push_back( new GenericRouterVct());</span>
<span class="lineNum">     154 </span><span class="lineCov">             64 :         mesh-&gt;interfaces.push_back ( new GenericInterface());</span>
<span class="lineNum">     155 </span>                :     }
<span class="lineNum">     156 </span>                : 
<span class="lineNum">     157 </span>                :     /*  Create the TPG and mc modules */
<span class="lineNum">     158 </span>                :     vector&lt;uint&gt;::iterator itr;
<span class="lineNum">     159 </span><span class="lineCov">             65 :     for( uint i=0; i&lt;no_nodes; i++)</span>
<span class="lineNum">     160 </span>                :     {
<span class="lineNum">     161 </span><span class="lineCov">             64 :         itr = find(mc_positions.begin(), mc_positions.end(), i);</span>
<span class="lineNum">     162 </span><span class="lineCov">             64 :         if( itr != mc_positions.end())</span>
<span class="lineNum">     163 </span><span class="lineCov">              8 :             mesh-&gt;processors.push_back( new NI() );</span>
<span class="lineNum">     164 </span>                :         else
<span class="lineNum">     165 </span>                :         {
<span class="lineNum">     166 </span><span class="lineCov">             56 :             mesh-&gt;processors.push_back( new GenericTPG() );</span>
<span class="lineNum">     167 </span><span class="lineCov">            168 :             static_cast&lt;GenericTPG*&gt;(mesh-&gt;processors[i])-&gt;set_trace_filename(traces[i]);</span>
<span class="lineNum">     168 </span><span class="lineCov">           1008 :             for ( uint j=0; j&lt;mc_positions.size(); j++)</span>
<span class="lineNum">     169 </span><span class="lineCov">            896 :                 static_cast&lt;GenericTPG*&gt;(mesh-&gt;processors[i])-&gt;mc_node_ip.push_back(mc_positions[j]);;</span>
<span class="lineNum">     170 </span>                :         }
<span class="lineNum">     171 </span>                :     }
<span class="lineNum">     172 </span>                : 
<span class="lineNum">     173 </span>                :     /* Create the links */
<span class="lineNum">     174 </span><span class="lineCov">            209 :     for ( uint i=0; i&lt;links; i++)</span>
<span class="lineNum">     175 </span>                :     { 
<span class="lineNum">     176 </span><span class="lineCov">            208 :         mesh-&gt;link_a.push_back(new GenericLink());</span>
<span class="lineNum">     177 </span><span class="lineCov">            208 :         mesh-&gt;link_b.push_back(new GenericLink());</span>
<span class="lineNum">     178 </span>                :     }
<span class="lineNum">     179 </span>                : 
<span class="lineNum">     180 </span><span class="lineCov">              1 :     mesh-&gt;connect_interface_processor();</span>
<span class="lineNum">     181 </span>                : 
<span class="lineNum">     182 </span>                :     /* Set all the component ids */
<span class="lineNum">     183 </span><span class="lineCov">              1 :     uint comp_id = 0, alink_comp_id = 1000, blink_comp_id = 5000;</span>
<span class="lineNum">     184 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes; i++ )</span>
<span class="lineNum">     185 </span>                :     {
<span class="lineNum">     186 </span><span class="lineCov">            128 :         mesh-&gt;processors[i]-&gt;setComponentId(comp_id++);</span>
<span class="lineNum">     187 </span><span class="lineCov">            128 :         mesh-&gt;interfaces[i]-&gt;setComponentId(comp_id++);</span>
<span class="lineNum">     188 </span><span class="lineCov">            128 :         mesh-&gt;routers[i]-&gt;setComponentId(comp_id++);</span>
<span class="lineNum">     189 </span>                :     }
<span class="lineNum">     190 </span>                : 
<span class="lineNum">     191 </span><span class="lineCov">            209 :     for ( uint i=0 ; i&lt;links; i++ )</span>
<span class="lineNum">     192 </span>                :     {
<span class="lineNum">     193 </span><span class="lineCov">            416 :         mesh-&gt;link_a[i]-&gt;setComponentId(alink_comp_id++);</span>
<span class="lineNum">     194 </span><span class="lineCov">            416 :         mesh-&gt;link_b[i]-&gt;setComponentId(blink_comp_id++);</span>
<span class="lineNum">     195 </span><span class="lineCov">            416 :         mesh-&gt;link_a[i]-&gt;setup();</span>
<span class="lineNum">     196 </span><span class="lineCov">            416 :         mesh-&gt;link_b[i]-&gt;setup();</span>
<span class="lineNum">     197 </span>                :     }
<span class="lineNum">     198 </span>                : 
<span class="lineNum">     199 </span>                :     /*  Set up the node ips for components */
<span class="lineNum">     200 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes ; i++ )</span>
<span class="lineNum">     201 </span>                :     {
<span class="lineNum">     202 </span><span class="lineCov">            128 :         mesh-&gt;interfaces[i]-&gt;node_ip = i;</span>
<span class="lineNum">     203 </span><span class="lineCov">            128 :         mesh-&gt;routers[i]-&gt;node_ip = i;</span>
<span class="lineNum">     204 </span><span class="lineCov">            128 :         mesh-&gt;processors[i]-&gt;node_ip = i;</span>
<span class="lineNum">     205 </span>                :     }
<span class="lineNum">     206 </span>                : 
<span class="lineNum">     207 </span>                :     /* Set the number of ports, vcs, credits and buffer sizes for the
<span class="lineNum">     208 </span>                :      * components */
<span class="lineNum">     209 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes ; i++ )</span>
<span class="lineNum">     210 </span>                :     {
<span class="lineNum">     211 </span><span class="lineCov">            128 :         mesh-&gt;interfaces[i]-&gt;set_no_vcs(vcs);</span>
<span class="lineNum">     212 </span><span class="lineCov">            128 :         mesh-&gt;interfaces[i]-&gt;set_no_credits(credits);</span>
<span class="lineNum">     213 </span><span class="lineCov">            128 :         mesh-&gt;interfaces[i]-&gt;set_buffer_size(credits);</span>
<span class="lineNum">     214 </span>                : //        mesh-&gt;processors[i]-&gt;set_output_path(output_path);
<span class="lineNum">     215 </span>                :     }
<span class="lineNum">     216 </span>                : 
<span class="lineNum">     217 </span><span class="lineCov">              1 :     mesh-&gt;setup();</span>
<span class="lineNum">     218 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes ; i++ )</span>
<span class="lineNum">     219 </span><span class="lineCov">            128 :         mesh-&gt;processors[i]-&gt;set_output_path(output_path);</span>
<span class="lineNum">     220 </span>                : 
<span class="lineNum">     221 </span>                :     /*  Set no of ports and positions for routing */
<span class="lineNum">     222 </span>                :     vector&lt; uint &gt; grid_x;
<span class="lineNum">     223 </span>                :     vector&lt; uint &gt; grid_y;
<span class="lineNum">     224 </span><span class="lineCov">              1 :     grid_x.resize(no_nodes);</span>
<span class="lineNum">     225 </span><span class="lineCov">              1 :     grid_y.resize(no_nodes);</span>
<span class="lineNum">     226 </span>                : 
<span class="lineNum">     227 </span>                :     /* Limitation of only modelling squares */
<span class="lineNum">     228 </span><span class="lineCov">              9 :     for ( uint i=0 ; i&lt;grid_size ; i++ )</span>
<span class="lineNum">     229 </span><span class="lineCov">             72 :         for ( uint j=0 ; j&lt;grid_size ; j++ )</span>
<span class="lineNum">     230 </span>                :         {
<span class="lineNum">     231 </span><span class="lineCov">            128 :             grid_x[(i*grid_size)+j] = j;</span>
<span class="lineNum">     232 </span><span class="lineCov">            128 :             grid_y[(i*grid_size)+j] = i;</span>
<span class="lineNum">     233 </span>                :         }
<span class="lineNum">     234 </span>                : 
<span class="lineNum">     235 </span>                : 
<span class="lineNum">     236 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes ; i++ )</span>
<span class="lineNum">     237 </span><span class="lineCov">            128 :         mesh-&gt;routers[i]-&gt;set_no_nodes(no_nodes);</span>
<span class="lineNum">     238 </span>                : 
<span class="lineNum">     239 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes ; i++ )</span>
<span class="lineNum">     240 </span><span class="lineCov">            384 :         for( uint j=0; j &lt; ports ; j++)</span>
<span class="lineNum">     241 </span><span class="lineCov">          20800 :             for( uint k=0; k &lt; no_nodes ; k++) // Assuming is a square mesh. </span>
<span class="lineNum">     242 </span>                :             {
<span class="lineNum">     243 </span><span class="lineCov">          40960 :                 static_cast&lt;GenericRouterVct*&gt;(mesh-&gt;routers[i])-&gt;set_grid_x_location(j,k, grid_x[k]);</span>
<span class="lineNum">     244 </span><span class="lineCov">          40960 :                 static_cast&lt;GenericRouterVct*&gt;(mesh-&gt;routers[i])-&gt;set_grid_y_location(j,k, grid_y[k]);</span>
<span class="lineNum">     245 </span>                :             }
<span class="lineNum">     246 </span>                : 
<span class="lineNum">     247 </span><span class="lineCov">              1 :     mesh-&gt;connect_interface_routers();</span>
<span class="lineNum">     248 </span><span class="lineCov">              1 :     mesh-&gt;connect_routers();</span>
<span class="lineNum">     249 </span>                : 
<span class="lineNum">     250 </span>                :     /*  Printing out all component after setup */
<span class="lineNum">     251 </span><span class="lineCov">             65 :     for ( uint i=0 ; i&lt;no_nodes; i++ )</span>
<span class="lineNum">     252 </span>                :     {
<span class="lineNum">     253 </span><span class="lineCov">            192 :         cout &lt;&lt; &quot;\nTPG: &quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; mesh-&gt;processors[i]-&gt;toString();</span>
<span class="lineNum">     254 </span><span class="lineCov">            192 :         cout &lt;&lt; &quot;\ninterface: &quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; mesh-&gt;interfaces[i]-&gt;toString();</span>
<span class="lineNum">     255 </span><span class="lineCov">            192 :         cout &lt;&lt; &quot;\nrouter: &quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; mesh-&gt;routers[i]-&gt;toString();</span>
<span class="lineNum">     256 </span>                :     }
<span class="lineNum">     257 </span>                : 
<span class="lineNum">     258 </span><span class="lineCov">            209 :     for ( uint i=0 ; i&lt;links ; i++ )</span>
<span class="lineNum">     259 </span>                :     {
<span class="lineNum">     260 </span><span class="lineCov">            624 :         cout &lt;&lt; &quot;\nlinka_&quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; mesh-&gt;link_a[i]-&gt;toString();</span>
<span class="lineNum">     261 </span><span class="lineCov">            624 :         cout &lt;&lt; &quot;\nlinkb_&quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; mesh-&gt;link_b[i]-&gt;toString();</span>
<span class="lineNum">     262 </span>                :     }
<span class="lineNum">     263 </span>                :     
<span class="lineNum">     264 </span><span class="lineCov">              1 :     Simulator::StopAt(max_sim_time);</span>
<span class="lineNum">     265 </span><span class="lineCov">              1 :     Simulator::Run();</span>
<span class="lineNum">     266 </span>                : 
<span class="lineNum">     267 </span><span class="lineCov">              1 :     cerr &lt;&lt; mesh-&gt;print_stats();</span>
<span class="lineNum">     268 </span>                : 
<span class="lineNum">     269 </span><span class="lineCov">              1 :     cerr &lt;&lt; &quot; Simulation Time: &quot; &lt;&lt; (time(NULL)-sim_start_time) &lt;&lt; endl;</span>
<span class="lineNum">     270 </span><span class="lineCov">              1 :     cerr &lt;&lt; &quot;------------ End SimIris ---------------------&quot; &lt;&lt; endl;</span>
<span class="lineNum">     271 </span>                : 
<span class="lineNum">     272 </span><span class="lineCov">              1 :     delete mesh;</span>
<span class="lineNum">     273 </span>                : 
<span class="lineNum">     274 </span><span class="lineCov">              1 :     return 0;</span>
<span class="lineNum">     275 </span><span class="lineCov">              2 : }                               /* ----------  end of function main  ---------- */</span>
<span class="lineNum">     276 </span>                : 
<span class="lineNum">     277 </span>                : 
<span class="lineNum">     278 </span>                : #endif   /* ----- #ifndef _simmc2mesh_cc_INC  ----- */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
